home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-18 | 3.5 KB | 140 lines | [TEXT/MPS ] |
- /*------------------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # Hierarchical Menu Example Application
- #
- # HierMenus
- #
- # HierMenus.r - Rez Source
- #
- # Copyright © 1988 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions: 1.0 8/88
- #
- # Components: HierMenus.p August 1, 1988
- # HierMenus.r August 1, 1988
- # HierMenus.make August 1, 1988
- #
- # This program is a simple example of how to use hierarchical menus
- # in your application.
- #
- # See Sample and TESample for the general structure and MultiFinder
- # techniques that we recommend that you use when building a new application.
- #
- ------------------------------------------------------------------------------*/
- /*
- * HierMenus Menu Example - Resources
- * Bryan Stearns 05May87
- */
-
- #include "Types.r"
-
- /* These define's are handy for disabling specific items in MENUs */
- #define AllItems 0b1111111111111111111111111111111 /* 31 flags */
- #define MenuItem1 0b000000001
- #define MenuItem2 0b000000010
- #define MenuItem3 0b000000100
- #define MenuItem4 0b000001000
- #define MenuItem5 0b000010000
- #define MenuItem6 0b000100000
- #define MenuItem7 0b001000000
- #define MenuItem8 0b010000000
- #define MenuItem9 0b100000000
-
-
- /* The File menu (it goes in the menu bar) */
- resource 'MENU' (128,"amenu") {
- 128, textMenuProc,
- AllItems & ~ MenuItem4, /* all on except the ---- */
- enabled, "A Menu",
- {
- "Font", noicon, "\$1B", "\0D129", plain; /* "\$1B" means "hierarchical"; */
- "Style", noicon, "\$1B", "\0D130", plain; /* "\0Dxxx" is the menu ID of the submenu. */
- "Size", noicon, "\$1B", "\0D131", plain;
- "-", noicon, nokey, nomark, plain;
- "Quit", noicon, "Q", noMark, plain
- }
- };
-
- /* the Font submenu */
- resource 'MENU' (129,"Font",preload) {
- 129, textMenuProc,
- AllItems,
- enabled, "Font",
- {
- /* font names will be inserted with AddResMenu at runtime */
- }
- };
-
- /* the Style submenu */
- resource 'MENU' (130,"Style",preload) {
- 130, textMenuProc,
- AllItems,
- enabled, "Style",
- {
- "Plain", noicon, "P", noMark, plain;
- "Bold", noicon, "B", noMark, $01;
- "Italic", noicon, "I", noMark, $02;
- "Underline", noicon, "U", noMark, $04;
- "Outline", noicon, noKey, noMark, $08;
- "Shadow", noicon, noKey, noMark, $10
- }
- };
-
- /* the Size submenu */
- resource 'MENU' (131,"Size",preload) {
- 131, textMenuProc,
- AllItems,
- enabled, "Size",
- {
- "9", noicon, noKey, noMark, plain;
- "10", noicon, noKey, noMark, plain;
- "12", noicon, noKey, noMark, plain;
- "14", noicon, noKey, noMark, plain;
- "18", noicon, noKey, noMark, plain;
- "24", noicon, noKey, noMark, plain
- }
- };
-
-
- /* Our window */
- resource 'WIND' (128) {
- {50, 50, 280, 462}, documentProc, visible, noGoAway, 0, "Hierarchical Menus Test"
- };
-
- /* Strings to draw */
- resource 'STR#' (128) {
- {
- "Hierarchical Menu Example";
- "Apple Developer Technical Support";
- "(BJS) 07May87";
- "Try the menus!"
- }
- };
-
- /* The “I need System 4.1 etc.” alert */
- resource 'ALRT' (128) {
- {50, 50, 180, 370}, 128, {
- OK, visible, sound1;
- OK, visible, sound1;
- OK, visible, sound1;
- OK, visible, sound1
- }
- };
-
- /* The item list for our “I need System 4.1 etc.” alert */
- resource 'DITL' (128) {
- {
- /* the “OK” button */
- {100, 220, 120, 300}, Button { enabled, "Finder" },
-
- /* The message */
- {10, 65, 90, 300}, StaticText { disabled,
- "The Hierarchical Menu Example requires a Macintosh II, SE, Plus, or "
- "512Ke personal computer, with system software version 4.1 or newer."
- }
- }
- };
-